// 模型索引文件，统一导出所有模型
const sequelize = require('../config/database');

// 导入所有模型
const Class = require('./Class');
const User = require('./User');
const Homework = require('./Homework');
const Submission = require('./Submission');

// 同步数据库表结构
const syncDatabase = async () => {
  try {
    await sequelize.sync({ alter: true });
    console.log('数据库表结构同步完成');
  } catch (error) {
    console.error('数据库表结构同步失败:', error);
  }
};

module.exports = {
  sequelize,
  syncDatabase,
  Class,
  User,
  Homework,
  Submission
};